<template>
  <v-app class="content-warp">
    <header-bar :info="info" />
    <Nuxt />
    <footer-bar :info="info" />
  </v-app>
</template>

<script>
import FooterBar from "../components/FooterBar.vue";
import HeaderBar from "../components/HeaderBar.vue";
import axios from "../utils/axios";
import Cache from "../utils/cache";
export default {
  components: { HeaderBar, FooterBar },
  name: "DefaultLayout",
  data() {
    return {
      loading: false,
      info: {},
    };
  },
  mounted() {
    const info = Cache.get("web_info");
    if (info) {
      this.info = info;
    }
    this.visitLog()
  
  },
  
  methods: {
    //访问日志
    visitLog(){
      let visit_tag = window.sessionStorage.getItem('visit_tag')
      if(visit_tag){
        return
      }
      window.sessionStorage.setItem('visit_tag',1)
      const data = {
        ip:window.returnCitySN?window.returnCitySN.cip:'获取ip失败',
        cname:window.returnCitySN?window.returnCitySN.cname:'获取城市失败',
        userAgent:window.navigator.userAgent,
        url:window.location.href,
        date:Math.round(Date.now()/1000),
      }
      axios.post('visitLog',{
        data:JSON.stringify(data)
      }).then(res=>{
        console.log(res)
      },err=>{
        console.log(err)
      })
    }
  },
};
</script>
<style scoped>
.app-warp {
  overflow-x: hidden;
}
</style>
<style>
main{
  min-height: 80vh;
}
pre code {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: solid 2px #adb1c2;
  overflow-x: auto;
}
</style>
